<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测评报告</title>
<!--[if IE]><script language="javascript" type="text/javascript" src="/javascripts/jquery/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="/javascripts/jquery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/javascripts/jquery/jquery.flot.min.js"></script>
<%= javascript_include_tag :fckeditor %>
<script src="/validation/lib/prototype.js" type="text/javascript"></script>
<script type="text/javascript" src="/javascripts/lib/effects.js"> </script>
<script type="text/javascript" src="/javascripts/window.js"> </script>
<!-- Add this to have a specific theme-->
<link href="../themes/alphacube.css" rel="stylesheet" type="text/css" />

<style>
*{ padding:0; margin:0; border:0;}
img{ border:0;}
h1,h2,h3,h4,h5,h6{ font-family:"宋体",Arial; font-size:12px; font-weight:normal;}
body{ font-family:"宋体",Arial; font-size:12px; }
ul,ol{ list-style:none;}
a{ color:#304d62; text-decoration:none;}
a:hover{ color:#FF0000; text-decoration:none;}
#page {margin:0 auto; width:750px;}

#header{ width:750px; float:left; height:100px;}
#header ol{ width:98px; height:24px; float:left; padding:42px 0 0 65px; }
#header ol li{ width:98px; height:24px;float:left;}

#header ul{ width:170px; height:84px; float:right; padding-right:62px; margin-top:20px;}
#header ul li{line-height:36px; font-size:14px; color:#FFFFFF; text-align:right;}
#header ul li a{ color:#FFFFFF; font-size:12px; padding-right:20px;}

#content{ width:750px; float:left;}
.contentt{ width:750px; float:left; }
.content01{ width:629px; height:78px; float:left; border-left:1px solid #b7b7b7; border-top:1px solid #b7b7b7; margin-left:58px; display:inline;}
.line01{ width:104px; height:25px; border-right:1px solid #b7b7b7; border-bottom:1px solid #b7b7b7; text-align:center; line-height:25px;}
.line02{ width:524px; height:25px; border-right:1px solid #b7b7b7; border-bottom:1px solid #b7b7b7; text-align:center; line-height:25px;}
.line03{ height:25px; border-right:1px solid #b7b7b7; border-bottom:1px solid #b7b7b7; text-align:center; line-height:25px;}

.content03a{ width:628px; float:left; border:1px solid #b7b7b7; }

.content02{ width:630px; float:left; margin-top:23px; padding-left:58px; color:#000000;}
.content02 span{ width:630px; line-height:26px; float:left; font-size:14px; font-weight:bold;}
.content02 p{ width:630px; font-size:14px; line-height:30px; margin-top:5px; text-indent:10px; float:left;}
.content02a{ width:375px; height:23px; float:left; border:1px solid #b7b7b7; line-height:23px; border-right:none;}
.line04{ border-right:1px solid #b7b7b7; text-align:center;}

.content05{ width:630px; float:left; margin-top:15px; font-size:12px;}
.content05 ul li{ width:610px; line-height:33px; float:left; padding-left:10px;}
.content03a{ width:628px; float:left; border:1px solid #b7b7b7; }
#zixunshiyj-p{ width:530px; line-height:33px; float:left; font-weight:bold;}
#zixunshiyj-span{ width:53px; height:20px; float:right; padding:7px 13px 0 0;}

.center{ width:750px; float:left;}
.center0{ width:630px; float:left; padding-left:58px;}

.black{ width:750px; height:97px; float:left; }
.black span{ width:101px; height:34px; float:right; padding-right:39px; margin-top:25px;}
#report-actions{ float:left; margin:10px 0 0 300px;}

#footer{ width:100%; height:200px; float:left; text-align:center; color:#295c72;}
#footer h1{ margin-top:100px;}

div #part-div{ width:628px; float:left; border:1px solid #b7b7b7;}
div #yijian {padding: 15px 15px 15px 15px;}
div #dimen-table {padding: 30px 15px 15px 30px;}
div #part-table {padding: 30px 15px 15px 30px;}
div #dimen-table tr td{padding: 5px 8px 5px 8px;}
div #part-div tr td{padding: 5px 8px 5px 8px;}

div #dimen-chart {padding: 20px 15px 15px 15px;}
div #part-chart {padding: 20px 15px 15px 15px;}
#report-title{font-weight:bold;}

#yijian-01{padding:20px 20px 20px 20px}
#yijian-02{padding:20px 20px 40px 20px}
/*特殊*/
.content06{ width:630px; float:left; margin-top:15px; font-size:14px;}
.content03a{ width:628px; float:left; border:1px solid #b7b7b7; }
.content06 p{ width:530px; line-height:33px; float:left; }

.cm{ width:600px; float:left; padding:15px 15px 15px 15px;}
.cm p{ width:600px; line-height:21px; margin-top:10px;}
.cm ul{ width:600px; float:left; margin-top:5px;}
.cm ul li{ width:600px; line-height:22px; float:left;}
.cm ol{ width:600px; float:left; margin-top:5px; padding-left:5px;}
.cm ol li{ width:600px; line-height:22px; float:left;}
.cm table{ border-left:1px solid #b7b7b7; border-top:1px solid #b7b7b7; float:left; line-height:20px; margin:10px 0;}
.cm tr td{ border-bottom:1px solid #b7b7b7; border-right:1px solid #b7b7b7; height:20px; line-height:20px;}
/*特殊*/

@media print{

}
</style>

<style type="text/css" media="print">
  .noprint{display : none }
</style>
  <%= javascript_include_tag :fckeditor %>   
  <script src="/validation/lib/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
 function show_bianji(){
   $("yijian-01").hide();
   $("yijian-02").show();
  }
  
  function hide_bianji(){
     $("yijian-01").show();
   $("yijian-02").hide();
  }
  
  function submit_form(){
    MyObject.UpdateEditorFormValue();
  var form=document.getElementById("edit_yijian");
   new Ajax.Updater(
      "yijian-01",
      form.action,
      {
        method: "post",
        asynchronous: true,
        evalScripts: true,
        parameters: Form.serialize(form)+ '&authenticity_token=' + window._token
      }
    );
  }
  //ajax提交 fck为空解决
    function MyClass()
{
        this.UpdateEditorFormValue = function()
        {
                for ( i = 0; i < parent.frames.length; ++i )
                        if ( parent.frames[i].FCK )
                                parent.frames[i].FCK.UpdateLinkedField();
        }
}
// instantiate the class
var MyObject = new MyClass();
</script>
</head>

<body>

<div id="page">
  <div id="main">

    <div id="header">
      <ol>
        <li><h3 style="font-size:medium">测评报告</h3></li>
      </ol>
      <ul>
        <li><%=current_user.name%></li>
        <li><a href="/login/logout">安全退出</a></li>
      </ul>
    </div>

    <div id="content">
      <div class="contentt">
        <div class="content01">
          <table width="629" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>
                <table width="629" border="0" cellspacing="0" cellpadding="0" height="25">
                  <tr>
                    <td align="center" class="line01">姓  名</td>
                    <td align="center" class="line01"><%=@test_record.username || "&nbsp;"%></td>
                    <td align="center" class="line01">性  别</td>
                    <td align="center" class="line01"><%=@test_record.gender || "&nbsp;"%></td>
                    <td align="center" class="line01">年  龄</td>
                    <td align="center" class="line01"><%=@test_record.age || "&nbsp;"%></td>
                  </tr>
                </table>

              </td>
            </tr>
            <tr>
              <td>
                <table width="629" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td class="line03">测评机构</td>
                    <td class="line02"><%=current_user.name || "&nbsp;"%></td>
                  </tr>
                </table>
              </td>
            </tr>
            <tr>
              <td>
                <table width="629" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td class="line03">量表名称</td>
                    <td class="line02"><%=@test.name || "&nbsp;"%></td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>

        </div>

        <div class="content02">
          <span>一、数据分析</span>

          <% if @test.show_total==true%>
          <p>得分统计 </p>

          <div class="content02a">
            <table width="375" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="70" class="line04">总  分</td>
                <td width="109" class="line04">
                  <% if  @test.formula and @test.formula.size > 0  %>
                    <%=count_by_formula(@total, @test.formula) %>　
                  <% else %>
                    <%= @total %>　
                  <% end %>
                </td>
                <% if @test.show_avg==true%>
                <td width="70" class="line04">均  分</td>
                <td class="line04"><%= eval(sprintf("%8.2f", @avg))%></td>
                <% end %>
              </tr>
            </table>
          </div>
          <% end %>
        </div>

      </div>

      <div class="center">
        <div class="center0">
          <% if @test.has_part == 1 %>
          <% if @test.show_parts ==true%>
          <div class="content05">
            <ul><li>分量表得分</li></ul>
            <div id="part-div">
             <div id="part-table">
                <table width="" border="0" cellspacing="0" cellpadding="0" style="border-left:1px solid #dadada; border-top:1px solid #dadada;">
                  <tr align="center">
                    <td width="" height="27" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">分量表</td>
                    <td width="" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">分值</td>
                    <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">均分</td>
                  </tr>
                  <% @part_results.each do |p| %>
                    <% if Part.find(p.part_id).formula  and Part.find(p.part_id).formula.size > 0%>
                    <tr align="center">
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=Part.find(p.part_id).name%></td>
                      <% if Part.find(p.part_id).show_total == true%>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=count_by_formula(p.total, Part.find(p.part_id).formula)%></td>
                      <% else %>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">-</td>
                      <% end %>
                      <% if Part.find(p.part_id).show_avg == true%>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=eval(sprintf("%8.2f", p.avg))%></td>
                       <% else %>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"> -</td>
                      <% end %>
                    </tr>
                    <% else %>
                    <tr align="center">
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=Part.find(p.part_id).name%></td>
                      <% if Part.find(p.part_id).show_total == true%>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=p.total%></td>
                       <% else %>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"> - </td>
                       <% end %>
                      <% if Part.find(p.part_id).show_avg == true%>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=eval(sprintf("%8.2f", p.avg))%></td>
                       <% else %>
                      <td  style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"> - </td>
                       <% end %>
                    </tr>
                    <% end %>
                  <% end %>
                </table>
              </div><!--part-table end--> 
              <!--part-chart-->
              <% if  @test.show_partcharts==true %>
               <div id="part-chart">
                <% datas_url = "/user/reports/part_report_xml/"+@test_record.id.to_s %>
                <% render_chart_html("/charts/Column2D.swf", datas_url, "", "", 480, 350, false) do-%>
                <% end -%>
              </div>              
              <% end %>
              <!--part-chart  end-->
            </div><!--part-div end-->
          </div><!--content05-->
          <% end %>
          <% end %>

        <% if @test.has_dimen == true %>
         <% if @test.show_dimens == true%>
          <div class="content05">
            <ul><li>因子分析</li></ul>
            <div class="content03a">

              <div id="dimen-table">

                  <table width="" border="0" cellspacing="0" cellpadding="0"
                      style="border-left:1px solid #dadada; border-top:1px solid #dadada;">
                    <tr align="center">
                      <td width="" height="27" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">因子</td>
                      <td width="" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">分值</td>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">均分</td>
                    </tr>
                      <% @dimen_results.each do |d| %>
                    <% if  Dimen.find(d.dimen.id).formula and Dimen.find(d.dimen.id).formula.size > 0%>
                    <tr>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=Dimen.find(d.dimen.id).name%></td>
                      <% if Dimen.find(d.dimen.id).show_total == true%>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=count_by_formula(d.total, Dimen.find(d.dimen.id).formula)%></td>
                      <% else %>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">-</td>
                      <% end %>
                      <% if Dimen.find(d.dimen.id).show_avg == true%>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%= eval(sprintf("%8.2f", d.avg)) %></td>
                      <% else %>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"> - </td>
                       <% end %>
                    </tr>
                    <% else  %>
                     <tr>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=Dimen.find(d.dimen.id).name%></td>
                      <% if Dimen.find(d.dimen.id).show_total == true%>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%=d.total%></td>
                      <% else %>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada">-</td>
                      <% end %>
                      <% if Dimen.find(d.dimen.id).show_avg == true%>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"><%= eval(sprintf("%8.2f", d.avg)) %></td>
                      <% else %>
                      <td style="border-bottom:1px solid #dadada; border-right:1px solid #dadada"> - </td>
                       <% end %>
                    </tr>
                    <% end %>
                    <% end %>
                    </table>
              </div>
             <% if  @test.show_dimencharts==true %>
              <div id="dimen-chart">
                <% datas_url = "/user/reports/report_xml/"+@test_record.id.to_s %>
                <% render_chart_html("/charts/Column2D.swf", datas_url, "", "", 480, 350, false) do-%>
                <% end -%>
              </div>
                 <% end %>
            </div>
          </div>

        <% end %>
        <% end %>
          <div class="content06">
            <p id="report-title">二、测评报告</p>

            <div class="content03a">

              <div class="cm" id="fck-killer">
                <%= @test.norm_info.description %>
              </div>
            </div>
          </div>

          <div class="content05">
            <p id="zixunshiyj-p">三、咨询师意见</p>
            <span id="zixunshiyj-span"></span>

            <div class="content03a" style="width:630px">
                
              <div id="yijian-01">
                <%= render :partial => "zxs_yj", :object => @test_record %>
              </div>

              <div style="display:none;"id="yijian-02">
                <form id="edit_yijian" name="edit_yijian" action="/user/reports/record_zxs_yj" method="post">
                    <%=fckeditor_textarea(:test_record, :zxs_yj, :toolbarSet=>"Easy" ,:width => '580px', :height => '250px')%>
                  <input type="hidden" name="record_id" value="<%=@test_record.id%>" />
                  <a href="javascript:;" onclick="submit_form(); hide_bianji();">
                    <img src="/images/user/report_list/baocun.jpg" alt=""/>
                  </a>
                </form>
              </div>

            </div>
          </div>

          
        </div>
      </div>

      <div class="black">
        <span style="margin-top:30px;">
          <a href="javascript:window.print();">打印</a>
        </span>
      </div>
    </div>
  </div>

</div>

<script type="text/javascript">
//控制fckeditor生成元素的样式
jQuery(".cm table").each(function(){
  jQuery(this).attr("border","0");
  jQuery(this).attr("cellspacing","0");
  jQuery(this).attr("cellpadding","0");
});

jQuery(".cm table tr td p").each(function(){
  jQuery(this).css({width: '100px'});
});

function open_win(url){
  window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=770, height=600")
}
</script>
</body>
</html>
